#!/bin/bash
basedir=$(cd `dirname $0`;pwd)
softwaredir=$basedir/packages
repoDir=/etc/yum.repos.d

## function 
function create_ansible_local_repo(){
cat <<EOF > $repoDir/ansible-local.repo
[ansible-local]
name=ansible-local
baseurl=file://$softwaredir/
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
EOF


echo "create repos"
createrepo -d $softwaredir
yum repolist
yum makecache
}

create_ansible_local_repo
